@extends('layouts.admin')
@section('content')
    @include('admin.nav')
    <table class="table mt-3 table-striped">
        <thead>
        <tr>
            <th>编号</th>
            <th>头像</th>
            <th>昵称</th>
            <th>邮箱</th>
            <th>手机号</th>
            <th style="width: 150px"></th>
        </tr>
        </thead>
        <tbody>
        @foreach($site->admins as $admin)
            <tr>
                <td class="align-middle">{{$admin['id']}}</td>
                <td class="align-middle"><img src="{{$admin->avatar}}" class="rounded-circle w35"></td>
                <td class="align-middle">{{$admin['name']}}</td>
                <td class="align-middle">{{$admin['email']}}</td>
                <td class="align-middle">{{$admin['mobile']}}</td>
                <td class="align-middle text-right pr-2">
                    <div class="btn-group btn-group-sm " role="group">
                        <a href="{{route('site.admin.role',[$site,$admin])}}"
                           class="btn btn-info">设置角色</a>
                        <btn-del class-name="btn btn-danger btn-sm"
                                 action='{{ route('site.admin.destroy',['site'=>$site,'admin'=>$admin]) }}'>
                            刪除
                        </btn-del>
                    </div>
                </td>

            </tr>
        @endforeach
        </tbody>
    </table>
    <user-search action="{{route('site.admin.search',$site)}}" title="添加管理员">
        <template v-slot:default="{user}">
{{--            :href前缀:在vue组件时，继续解析，href='……+user.id'--}}
            <a :href="'/site/{{$site['id']}}/admin/add/'+user.id" class="btn btn-info" >设置为管理员</a>
        </template>
    </user-search>


@endsection

